load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("//rules:gomock.bzl", "gomock")

go_library(
    name = "client",
    srcs = [
        "client.go",
    ],
    importpath = "github.com/bazelbuild/rules_go/gomock/client",
    visibility = ["//visibility:public"],
)

# Build the mocks using archive mode (i.e. without passing source)
gomock(
    name = "mocks",
    out = "client_mock.go",
    interfaces = ["Client"],
    library = ":client",
    package = "client",
    visibility = ["//visibility:public"],
)

# Build the mocks using mock_names renaming.
gomock(
    name = "renamed_mocks",
    out = "client_mock_renamed.go",
    interfaces = ["Client"],
    library = ":client",
    mock_names = {
        "Client": "MockRenamedClient",
    },
    package = "client",
    visibility = ["//visibility:public"],
)

go_test(
    name = "client_test",
    srcs = [
        "client_mock.go",
        "client_mock_renamed.go",
        "client_test.go",
    ],
    embed = [":client"],
    deps = ["@org_uber_go_mock//gomock"],
)
